Test-Series - programming logic

Test Number 14/15

Q: Tarun wants to write a code to divide two numbers. He wants to warn the user and terminate the program if he or she enters 0 as the divisor. Which programming construct can he use to do this?
A. None of these
B. Decision-making
C. Recursion
D. Recursion
Solution: The correct answer is:
Decision-making
Q: The && and || operators
A. combine two numeric values short hand operator, &
B. compare two boolean values
C. compare two numeric values
D. none of these
Solution: The correct answer is:
compare two boolean values
Q: What is maximum dimension that array can have in c programming ?
A. 3
B. Theoretically No Limit but practically limit depends on memory
C. 4
D. 2
Solution: The correct answer is:
Theoretically No Limit but practically limit depends on memory
Q: Array is an example of _______ type memory allocation.
A. Run Time
B. Compile Time
C. Time Run
D. Time Complie
Solution: The correct answer is:
Compile Time
Q: In an assignment statement a=b; which of the following statement is true ?
A. The value of b is assigned to variable a but if b changes later, it will not effect the value of variable a.
B. The value of variable a is assigned to variable b, and the value of variable b is asssigned to variable a.
C. The value of b is assigned to variable a but if b changes later, it will effect the value of variable a
D. The variable a and the variable b are same.
Solution: The correct answer is:
The value of b is assigned to variable a but if b changes later, it will not effect the value of variable a.
Q: The time complexity of linear search algorithm over an array of n elements is
A. O (n)
B. O (log2 n)
C. O (n log2 n )
D. O (n2)
Solution: The correct answer is:
O (n)
Q: What will be the output of the following code segment?

//assume all header files are attached

int x=24, y=39, z=45
z=x+y;
y=z-y;
x=z-y;
printf("
%d%d%d",x,y,z);
A. 39 24 63
B. 24 39 63
C. 24 39 45
D. 39 24 45
Solution: The correct answer is:
39 24 63
Q: To solve a problem, it is broken in to a sequence of smaller sub-problems, till a stage that the sub-problem can be easily solved. What is this design approach called?
A. None of these
B. Top-down Approach
C. Procedural Programming
D. Bottom-Up Approach
Solution: The correct answer is:
Top-down Approach
Q: Which of the following is not a valid relational operator?
A. ==
B. *
C. >=
D. <=
Solution: The correct answer is:
*

You Have Score    /9